﻿using aier.business.logic;
using aier.dataaccess.model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;

namespace aier.wx.api.selfhost.Controllers
{
    /// <summary>
    /// 区域
    /// </summary>
    //[Authorize]
    [RoutePrefix("api/AreaInfo")]
    public class AreaInfoController:ApiController
    {
        /// <summary>
        /// 区域逻辑
        /// </summary>
        public AreaInfoBll areaInfoBll { get; set; }
        /// <summary>
        /// 根据市查所属区县 
        /// 原程序 LocationQueryServiceImpl/queryAreaByCity
        /// </summary>
        /// <param name="cityid"></param>
        /// <returns></returns>
        [HttpGet]
        [ActionName("QueryAreaByCityId")]
        public IHttpActionResult QueryAreaByCityId(Guid cityid)
        {
            List<AreaInfoView> areaViews = areaInfoBll.QueryAreaByCityId(cityid);
            return Ok<List<AreaInfoView>>(areaViews);
        }
        /// <summary>
        /// 根据区域编号查询区域信息 LocationQueryServiceImpl/queryAreaById
        /// </summary>
        /// <param name="areaid"></param>
        /// <returns></returns>
        [HttpGet]
        [Route("QueryAreaById")]
        public IHttpActionResult QueryAreaById(Guid areaid)
        {
            AreaInfoView areaInfoView = areaInfoBll.QueryAreaById(areaid);
            return Ok<AreaInfoView>(areaInfoView);
        }
    }
}
